import { request } from '@umijs/max'

export interface ApiResponse<T> {
  code: number
  msg: string
  data: T
  success: boolean
}

export interface LoginResponse {
  token: string
  info: {
    userCode: string
    name: null
    email: null
    address: null
    domain: null
    shopCode: null
    userType: number
    platformHostingAddress: null
    registerCreator: null
    creatorDomain: null
    creatorAddress: null
    creatorUserCode: null
    shopState: null
    state: null
    userAddress: null
    registerWay: null
    firstLogin: null
    userSignType: null
    id: string

  }
  rongCloudToken: null
  isSeller: boolean
}
/** 登录接口 */
export async function login(data: {
  email: string
  password: string
}) {
  return request<ApiResponse<LoginResponse>>('/api/ofm/ofm-user/v1/login', {
    method: 'POST',
    data
  })
}
